Deprecated in 1.32, no callers.
Change-Id: Id2d59c303fd60fab2b323af6cab137fdf74b5377
* @return CryptRand
*/
public function getCryptRand() {
+ wfDeprecated( __METHOD__, '1.32' );
return $this->getService( 'CryptRand' );
}
* @return string
*/
protected function initialRandomState() {
+ wfDeprecated( __METHOD__, '1.32' );
return '';
}
* @author Tim Starling
*/
protected function driftHash( $data ) {
+ wfDeprecated( __METHOD__, '1.32' );
return '';
}
* @return string A new weak random state
*/
protected function randomState() {
+ wfDeprecated( __METHOD__, '1.32' );
return '';
}
* @return bool Always true
*/
public function wasStrong() {
+ wfDeprecated( __METHOD__, '1.32' );
return true;
}
* @return string Raw binary random data
*/
public function generate( $bytes ) {
+ wfDeprecated( __METHOD__, '1.32' );
$bytes = floor( $bytes );
return random_bytes( $bytes );
}
* @return string Hexadecimal random data
*/
public function generateHex( $chars ) {
+ wfDeprecated( __METHOD__, '1.32' );
return MWCryptRand::generateHex( $chars );
}
}
* @return CryptRand
*/
protected static function singleton() {
+ wfDeprecated( __METHOD__, '1.32' );
return MediaWikiServices::getInstance()->getCryptRand();
}
* @return bool Always true
*/
public static function wasStrong() {
+ wfDeprecated( __METHOD__, '1.32' );
return true;
}
* @return string Raw binary random data
*/
public static function generate( $bytes ) {
+ wfDeprecated( __METHOD__, '1.32' );
return random_bytes( floor( $bytes ) );
}
* @group MediaWiki
*/
class MediaWikiServicesTest extends MediaWikiTestCase {
+ private $deprecatedServices = [ 'CryptRand' ];
/**
* @return Config
$getterCases[$name] = [
'get' . $service,
$class,
+ in_array( $service, $this->deprecatedServices )
];
}
/**
* @dataProvider provideGetters
*/
- public function testGetters( $getter, $type ) {
+ public function testGetters( $getter, $type, $isDeprecated = false ) {
+ if ( $isDeprecated ) {
+ $this->hideDeprecated( MediaWikiServices::class . "::$getter" );
+ }
+
// Test against the default instance, since the dummy will not know the default services.
$services = MediaWikiServices::getInstance();
$service = $services->$getter();